from kafka import KafkaConsumer, TopicPartition

# To consume latest messages and auto-commit offsets
consumer = KafkaConsumer("kafka_raspberry_pi",
                         #security_protocol="SASL_PLAINTEXT",
                         #sasl_mechanism="PLAIN",
                         #sasl_plain_username="admin",
                         #sasl_plain_password="admin",
                         # sasl_plain_password="ffka3&789",
                         bootstrap_servers=[
                             "172.16.8.29:9092"
                             , "172.16.8.29:9093"
                         ],
                         # bootstrap_servers=["172.16.8.52:19096", "172.16.8.52:19092", "172.16.8.52:19093", "172.16.8.52:19094", "172.16.8.52:19095"],
                         group_id="kafka_elk")

for msg in consumer:
    print(msg)
